
<HTML>
<HEAD>
<TITLE>Darwin Streaming Server - About the Source Code</TITLE>
</HEAD>
<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff">

<H2 ALIGN="CENTER">Darwin Streaming Server </H2>
<H2 ALIGN="CENTER">Source Code Description</H2>
<P>&nbsp;</P>
<P>This document provides detailed information on the internals of the Darwin Streaming Server. The server implements four standard IETF protocols, RTSP (Real-time streaming protocol, RFC 2326), RTP (Real-time Transport Protocol, RFC 1889), RTCP (Real-time transport control protocol, RFC 1889), and SDP (Session description protocol, RFC 2327). Before making modifications to the server code is may help to be familiar with those RFCs.</P>
<P>&nbsp;</P>
<H3>Introduction</H3>
<P>The Darwin Streaming Server source code is written entirely in C++, and pervasively uses object-oriented concepts such as inheritance and polymorphism. Almost exclusively, there is one C++ class per .h / .cpp file pair, and those file names match the class name.</P>
<P>The code for each of the server's subsystems is separated out into separate folders in the source hierarchy. The following is a short description of each subsytem.</P>
<P>&nbsp;</P>
<H3>Common Utilities (in CommonUtilitiesLib)</H3>
<P>Common Utilities is a toolkit of thread management, data structure, networking, and text parsing utilities. Darwin Streaming Server and associated tools use these classes to accomplish the following three goals: </P>

<UL>
<LI>Reduce repeated code by abstracting similar or identical tasks, </LI>
<LI>Make the higher level code simpler through encapsulation, </LI>
<LI>Separate out any and all platform-specific code.</LI></UL>

</BR>
<P>Here is a short description of all the classes in the Common Utilities subsystem by group:</P>

<UL>
<LI>OS Classes: Platform-specific code abstractions for timing, condition variables, mutexes, and threads: OS, OSCond, OSMutex, OSThread, OSFileSource. Data structures: OSQueue, OSHashTable, OSHeap, OSRef.</BR></BR></LI>
<LI>Sockets: Platform-specific code abstractions for TCP and UDP networking. Socket classes are generally asynchronous (or non-blocking), and can send events to "Task objects". For a complete description on how this works, see "What are task objects?" in the FAQ section. Classes are: EventContext, Socket, UDPSocket, UDPDemuxer, UDPSocketPool, TCPSocket, TCPListenerSocket.</BR></BR></LI>
<LI>Parsing Utilities: These classes serve as a toolkit for parsing and formatting text. Classes are: StringParser, StringFormatter, StrPtrLen, StringTranslator.</BR></BR></LI>
<LI>Tasks: These classes implement the asynchronous event mechanism the server uses. For a complete description of how tasks work, see "What are task objects?" in the FAQ section. Classes include: Task, TimeoutTask, IdleTask.</BR></BR></LI>
<LI>RTCPUtilitiesLib: Classes for encoding and decoding RTCP packets(BR QTFileLib - Simple API for parsing the Hint Track format and generating packets.</BR></BR></LI></UL>

<P>&nbsp;</P>
<H3>Server Core (in Server.tproj)</H3>
<P>This folder contains the core server code, which can be divided into three categories: server core, RTSP specific, and RTP specific.</P>

<UL>
<LI>RTSP subsystem: These classes handle the parsing &amp; processing of RTSP requests, and implement the RTSP part of the QTSS module API. Several of the classes correspond directly to elements of the QTSS API (for instance, RTSPRequestInterface is a QTSS_RTSPRequestObject). There is one RTSP session object per RTSP TCP connection. The RTSPSession object is a Task object that processes RTSP related events.</BR></BR></LI>
<LI>RTP subsystem: These classes handle the sending of media data. The RTPSession object contains the data associated with each RTSP session ID. Each RTPSession is a Task object that can be scheduled to send RTP packets. The RTPStream object represents a single RTP stream. Any number of RTPStream objects can be associated with a single RTPSession. These two objects implement the RTP specific parts of the QTSS module API.</BR></BR></LI>
<LI>Server core: Classes in this subsystem are prefixed by QTSS. QTSServer handles startup and shutdown. QTSServerInterface stores server globals and compiles server statistics. QTSSPrefs is a data store for server preferences. QTSSModule, QTSSModuleInterface, and QTSSCallbacks are classes whose sole purpose is to support the QTSS module API.</BR></BR></LI>
</UL>

<P>&nbsp;</P>
<FONT SIZE=2><P>&copy; 1999-2003 Apple Computer, Inc. All rights reserved. Apple, the Apple logo, Mac, Macintosh, PowerBook, Power Macintosh, and QuickTime are trademarks of Apple Computer, Inc., registered in the United States and other countries. iBook, iMac, and Power Mac are trademarks of Apple Computer, Inc. All other product names are trademarks or registered trademarks of their respective holders.</P>
</FONT><P>&nbsp;</P></BODY>
</HTML>
